<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0.1 Transitional//EN">
<html>
<head>
    <meta charset="UTF-8">
    <title>float浮动效果</title>

    <style type="text/css">
        body{
            margin: 0;
            padding: 0;
        }
        div{
            width:200px;
            height:100px;
            border:2px solid blue;
        }
        .d1{
            /* float:left;  */
            background-color: red;
            /*设置右侧浮动效果*/
            float: right;
        }
        .d2 {
            width: 250px;
            height: 300px;
            background-color: blue;
        }
        .d3 {
            width: 300px;
            height: 200px;
            background-color: green;
        }
        .d4 {
            width: 150px;
            height: 100px;
            background-color: grey;
        }

        #div1 {
            top:100px;/*距离上边框有100px*/
            right: 100px;
            position: absolute;/*将该标签从文档流中取出，后面的标签自动向上补充*/
        }

        #div2{
            /*将该标签还在文档流中，后面的标签没有移动*/
            position: relative;
            top:200px;
            left:50px;
        }

    </style>

</head>
<body>

<div class="d1" id="div1">
    1111
</div>
<!-- 设置顶部边框的颜色 -->
<div class="d2" id="div2">
    2222
</div>
<div class="d3">
    3333
</div>

<div class ="d4">4444</div>
<hr>

</body>

</html>
















